@fontColor: #666;
@defaultBorderColor: #E6E6E6;
@disabledColor: #C2C2C2;
@border: 1px solid @defaultBorderColor;

@-webkit-keyframes xm-upbit {
	from {-webkit-transform: translate3d(0, 30px, 0);opacity: .3}
	to {-webkit-transform: translate3d(0, 0, 0);opacity: 1}
}
@keyframes xm-upbit {
	from {transform: translate3d(0, 30px, 0);opacity: .3}
	to {transform: translate3d(0, 0, 0);opacity: 1}
}

@-webkit-keyframes loader {
    0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}
@keyframes loader {
    0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

xm-select{
	*{
		margin: 0;
		padding: 0;
		box-sizing: border-box;
		font-size: 14px;
		font-weight: 400;
		// color: @fontColor;
		text-overflow: ellipsis;
		user-select: none;
		-ms-user-select: none;
		-moz-user-select: none;
		-webkit-user-select: none;
	}

	background-color: #FFF;
	position: relative;
	border: @border;
	border-radius: 2px;
	display: block;
	width: 100%;
	cursor: pointer;

	&:hover{
		border-color: #C0C4CC;
	}

	& > .xm-tips{
		color: #999999;
		padding: 0 10px;
        position: absolute;
		display: flex;
        height: 100%;
        align-items: center;
	}

	& > .xm-icon{
		display: inline-block;
		overflow: hidden;
		position: absolute;
		width: 0;
		height: 0;
		right: 10px;
		top: 50%;
		margin-top: -3px;
		cursor: pointer;
		border: 6px dashed transparent;
		border-top-color: #C2C2C2;
		border-top-style: solid;
		transition: all .3s;
		-webkit-transition: all .3s
	}

	& > .xm-icon-expand{
		margin-top: -9px;
		transform: rotate(180deg);
	}

	& > .xm-label{
        &.single-row{
            position: absolute;
            top: 0;
            bottom: 0px;
            left: 0px;
            right: 30px;
            overflow: auto hidden;
            .scroll{
                overflow-y: hidden;
            }
            .label-content{
                flex-wrap: nowrap;
            }
        }
        &.auto-row{
            .label-content{
                flex-wrap: wrap;
            }
        }

		.scroll{
			.label-content{
				display: flex;
                padding: 3px 30px 3px 10px;
			}
		}

		.xm-label-block{
			display: flex;
			position: relative;
			padding: 0px 5px;
			margin: 2px 5px 2px 0;
			border-radius: 3px;
			align-items: baseline;
			color: #FFF;

			& > span{
				display: flex;
				color: #FFF;
                white-space: nowrap;
			}

			& > i{
				color: #FFF;
				margin-left: 8px;
				font-size: 12px;
				cursor: pointer;
				display: flex;
			}

			&.disabled{
				background-color: @disabledColor !important;
				cursor: no-drop !important;
				&>i{
					cursor: no-drop !important;
				}
			}
		}
	}

	& > .xm-body {
		position: absolute;
		left: 0;
		top: 42px;
		padding: 5px 0;
		z-index: 999;
		width: 100%;
		border: @border;
		// max-height: 300px;
		// overflow-y: auto;
		background-color: #fff;
		border-radius: 2px;
		box-shadow: 0 2px 4px rgba(0, 0, 0, .12);
		animation-fill-mode: both;
		animation-name: xm-upbit;
		animation-duration: .3s;
		animation-fill-mode: both;

        .scroll-body{
            overflow: auto;

            .scrollBorder() {
                -webkit-border-radius: 2em;
                -moz-border-radius: 2em;
                -ms-border-radius: 2em;
                border-radius:2em;
            }

            &::-webkit-scrollbar{  width: 8px; }
            &::-webkit-scrollbar-track{ .scrollBorder(); background-color: #FFF; }
            &::-webkit-scrollbar-thumb{ .scrollBorder(); background-color: #C2C2C2; }
        }

		&.up{
			top: auto;
			bottom: 42px;
		}

        .xm-group{
            cursor: default;
            &-item{
                display: inline-block;
                cursor: pointer;
                padding: 0 10px;
                color: #999;
                font-size: 12px;
            }
        }

		.xm-option{
			display: flex;
			align-items: center;
			position: relative;
			padding: 0 10px;
			cursor: pointer;

			&:hover{
				background-color: #f2f2f2;
			}
			&-icon{
				color: transparent;
				display: flex;
				border: @border;
				border-radius: 3px;
				justify-content: center;
				align-items: center;
			}
			&-icon.xm-icon-danx{
				border-radius: 100%;
			}
			&-content{
				display: flex;
				position: relative;
				padding-left: 15px;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
				color: @fontColor;
				width: calc(100% - 20px);
			}

            &.hide-icon .xm-option-content{
                padding-left: 0;
            }
            &.selected.hide-icon .xm-option-content{
                color: #FFF !important;
            }
		}

		.xm-select-empty{
			text-align: center;
			color: #999;
		}

		.disabled{
			cursor: no-drop;
			&:hover{
				background-color: #FFF;
			}
			.xm-option-icon{
				border-color: @disabledColor !important;
			}
			.xm-option-content{
				color: @disabledColor !important;
			}

			&.selected>.xm-option-icon{
				color: @disabledColor !important;
			}
		}

		.xm-search{
			background-color: #FFF !important;
			position: relative;
			padding: 0 10px;
			margin-bottom: 5px;
			cursor: pointer;

			&>i{
				position: absolute;
                color: @fontColor;
			}

			&-input{
				border: none;
				border-bottom: 1px solid #E6E6E6;
				padding-left: 27px;
				cursor: text;
			}
		}

		.xm-paging{
			padding: 0 10px;
			display: flex;
			margin-top: 5px;

			&>span:first-child{
				border-radius: 2px 0 0 2px;
			}
			&>span:last-child{
				border-radius: 0 2px 2px 0
			}

			&>span{
				display: flex;
				flex: auto;
				justify-content: center;
				vertical-align: middle;
				padding: 0 15px;
				margin: 0 -1px 0 0;
				background-color: #fff;
				color: #333;
				font-size: 12px;
				border: 1px solid #e2e2e2;
			}
		}

        .xm-toolbar{
            padding: 0 10px;
            display: flex;
            margin: -3px 0;
            cursor: default;

            .toolbar-tag{
                cursor: pointer;
                display: flex;
                margin-right: 20px;
                color: @fontColor;
                align-items: baseline;

                &:hover{
                    opacity: .8;
                }
                &:active{
                    opacity: 1;
                }

                &>i{
                    margin-right: 2px;
                    font-size: 14px;
                }

                &:last-child{
                    margin-right: 0;
                }
            }
        }

        .xm-body-custom{
            line-height: initial;
            cursor: default;

            *{
                box-sizing: initial;
            }
        }
	}

	.xm-input{
		cursor: pointer;
		border-radius: 2px;
		border-width: 1px;
		border-style: solid;
		border-color: #E6E6E6;
		display: block;
		width: 100%;
		box-sizing: border-box;
		background-color: #FFF;
		line-height: 1.3;
		padding-left: 10px;
		outline: 0;
	}

	.dis{
		display: none;
	}

	.loading{
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(255,255,255,.6);
		display: flex;
		align-items: center;
		justify-content: center;



		.loader{
			border: .2em dotted currentcolor;
			border-radius: 50%;
			-webkit-animation: 1s loader linear infinite;
			animation: 1s loader linear infinite;

			display: inline-block;
			width: 1em;
			height: 1em;
			color: inherit;
			vertical-align: middle;
			pointer-events: none;
		}
	}

    .xm-select-default{
        display: none !important;
    }

}

//不同尺寸下的数据调整
.mixin(@size){
    @height: @size;
    @heightLabel: @height - 6px;
    @heightItem: @heightLabel - 4px;
    @iconSize: @size / 2;

    min-height: @height;
    line-height: @height;
    .xm-input{
        height: @height;
    }
    .xm-label{
        .scroll .label-content{
            line-height: @heightLabel;
        }
        .xm-label-block{
            height: @heightItem;
            line-height: @heightItem;
        }
    }
    .xm-body .xm-option .xm-option-icon{
        height: @iconSize;
        width: @iconSize;
        font-size: @iconSize;
    }
    .xm-paging>span{
        height: @heightLabel;
        line-height: @heightLabel;
    }
}
xm-select[size='large']{
    .mixin(40px)
}
xm-select{//[size='medium']
    .mixin(36px)
}
xm-select[size='small']{
    .mixin(32px)
}
xm-select[size='mini']{
    .mixin(28px)
}


//layui的一些样式兼容
.layui-form-pane{
    xm-select{
        margin: -1px -1px -1px 0;
    }
}
